.TH std::indirectly_readable_traits 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::indirectly_readable_traits \- std::indirectly_readable_traits

.SH Synopsis
   Defined in header <iterator>
   template< class I >                                           \fB(1)\fP \fI(since C++20)\fP
   struct indirectly_readable_traits {};
   template< class T >

   struct indirectly_readable_traits<T*> :                       \fB(2)\fP \fI(since C++20)\fP

       /* cond-value-type */<T> {};
   template< class I >

       requires std::is_array_v<I>
   struct indirectly_readable_traits<I>;                         \fB(3)\fP \fI(since C++20)\fP

   { using value_type =
   std::remove_cv_t<std::remove_extent_t<I>>; }
   template< class T >

   struct indirectly_readable_traits<const T> :                  \fB(4)\fP \fI(since C++20)\fP

       indirectly_readable_traits<T> {};
   template< /* has-member-value-type */ T >

   struct indirectly_readable_traits<T> :                        \fB(5)\fP \fI(since C++20)\fP

       /* cond-value-type */<typename T::value_type> {};
   template< /* has-member-element-type */ T >

   struct indirectly_readable_traits<T> :                        \fB(6)\fP \fI(since C++20)\fP

       /* cond-value-type */<typename T::element_type> {};
   template< /* has-member-value-type */ T >

       requires /* has-member-element-type */<T>                 \fB(7)\fP \fI(since C++20)\fP

   struct indirectly_readable_traits<T> {};
   template< /* has-member-value-type */ T >

       requires /* has-member-element-type */<T> &&
                std::same_as<std::remove_cv_t<typename
   T::element_type>,                                             \fB(8)\fP \fI(since C++20)\fP
                             std::remove_cv_t<typename
   T::value_type>>
   struct indirectly_readable_traits<T> :

       /* cond-value-type */<typename T::value_type> {};
   Helper classes and concepts
   template< class >                                             \fB(1)\fP (exposition only*)
   struct /* cond-value-type */ {};
   template< class T >

       requires std::is_object_v<T>                              \fB(2)\fP (exposition only*)
   struct /* cond-value-type */ <T>

   { using value_type = std::remove_cv_t<T>; };
   template< class T >

   concept /* has-member-value-type */ =                         \fB(3)\fP (exposition only*)

       requires { typename T::value_type; };
   template< class T >

   concept /* has-member-element-type */ =                       \fB(4)\fP (exposition only*)

       requires { typename T::element_type; };

   Computes the associated value type of the template argument. If the associated value
   type exists, it is represented by the nested type value_type, otherwise value_type
   is not defined. A program may specialize indirectly_readable_traits for a
   program-defined type.

.SH Explanation

   The specializations above can be informally described as below.

   Given a type T, its associated value type V is determined as follows:

     * If T is const-qualified, V is the associated value type of const-unqualified T.
     * Otherwise, if T is an array type, V is the cv-unqualified array element type.
     * Otherwise, a conditional value type C is determined first:

     * If T is a pointer type, C is the pointed-to type.
     * Otherwise, if T has nested types value_type and element_type:

     * If these types are the same (not considering cv-qualification), C is typename
       T::value_type.
     * Otherwise, C is undefined.
     * Otherwise, if T has the nested type value_type but not element_type, C is
       typename T::value_type.
     * Otherwise, if T has the nested type element_type but not value_type, C is
       typename T::element_type.
     * Otherwise, C is undefined.
   Then V is determined from C as follows:
     * If C is undefined, or C is not an object type, V is undefined.
     * Otherwise, V is cv-unqualified C.

.SH Notes

   value_type is intended for use with indirectly_readable types such as iterators. It
   is not intended for use with ranges.

.SH Example

    This section is incomplete
    Reason: no example

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

      DR    Applied to          Behavior as published              Correct behavior
                       specializations (5,6) were ambiguous
   LWG 3446 C++20      for types having                        added specialization (8)
                       both value_type and element_type nested
                       types
                       LWG 3446 introduced hard error for
   LWG 3541 C++20      ambiguous cases                         added specialization (7)
                       that value_type and element_type are
                       different

.SH See also

   indirectly_readable     specifies that a type is indirectly readable by applying
   (C++20)                 operator *
                           (concept)
   iter_value_t
   iter_reference_t
   iter_const_reference_t
   iter_difference_t
   iter_rvalue_reference_t
   iter_common_reference_t computes the associated types of an iterator
   (C++20)                 (alias template)
   (C++20)
   (C++23)
   (C++20)
   (C++20)
   (C++20)
   iterator_traits         provides uniform interface to the properties of an iterator
                           \fI(class template)\fP

.SH Category:
     * Todo no example
